import fs from 'fs';

export function saveArrayBufferAsImage(arrayBuffer, filename) {
    const buffer = Buffer.from(arrayBuffer);
    fs.writeFileSync(filename, buffer);
}


export async function saveImages(app: any, name) {

    const representation = await app.getGraphAsync()
    const image = await representation.drawMermaidPng();
    const arrayBuffer = await image.arrayBuffer();
    saveArrayBufferAsImage(arrayBuffer, name)

}